//
//  XbnFocusPageControl.m
//  XbnLcBuyer
//
//  Created by ZhaoDongBo on 15/9/9.
//  Copyright (c) 2015年 ZhaoDongbo. All rights reserved.
//

#import "XbnFocusPageControl.h"

@implementation XbnFocusPageControl

-(void)updateDots
{
    for (int i = 0; i< [self.subviews count]; i++) {
        UIImageView* dot = [self.subviews objectAtIndex:i];

        CGSize size;
        size.height = 9;
        size.width = 9;
        [dot setFrame:CGRectMake(dot.frame.origin.x, dot.frame.origin.y, size.width,size.height)];
        dot.layer.cornerRadius = 4.5;
        
        if (i == self.currentPage){
            
            dot.backgroundColor = UIColorFromRGB(0xff7a21,1);
//            dot.center = CGPointMake(dot.center.x, self.frame.size.height/2.0);
            
//            dot.layer.borderColor = UIColorFromRGB(0xff7a21,1).CGColor;
//            dot.layer.borderWidth = 1;
        }
        else{
            
            dot.backgroundColor = UIColorFromRGB(0xffffff,0.4);
//            dot.layer.borderColor = UIColorFromRGB(0x949494,1).CGColor;
//            dot.layer.borderWidth = 0;
        }
    }
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    [self updateDots];
}

-(void)setCurrentPage:(NSInteger)currentPage
{
    [super setCurrentPage:currentPage];
    [self updateDots];
}

@end
